package com.app.car.bean;


import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;
import java.util.List;

public class BaseDataDeviceListBean extends BaseListBean {


    private ArrayList<BaseDataDeviceListData> list = new ArrayList<BaseDataDeviceListData>();
    public ArrayList<BaseDataDeviceListData> getList() {
        return list;
    }
    public void setList(ArrayList<BaseDataDeviceListData> list) {
        this.list = list;
    }

    @JSONField(serialize = false)
    public void addListBean(BaseDataDeviceListBean listbean) {
        if (listbean == null)
            return;
        if (this.getCurrentPage() == INIT_PAGE) {
            setList(listbean.getList());
        } else {
            if (list == null)
                list = new ArrayList<BaseDataDeviceListData>();
            list.addAll(listbean.getList());
        }
        setListBeanData(listbean);
    }

    public List<String> getAllName(){
        List<String> listUnit = new ArrayList<>();
        for (BaseDataDeviceListData location : list){
            listUnit.add(location.getSna());
        }
        return listUnit;
    }


    public String[] getAllNames(){
        List<String> locationList = getAllName();
        if(locationList == null || locationList.size()== 0){
            return null;
        }
        String[] arr = locationList.toArray(new String[locationList.size()]);
        return arr;
    }

}
